<?php
MYTCONN();
$Flag = '';
$Channel = '';
$Country = '';

$__sysChannels = array('Ambos','Saida', 'Entrada');
$aml_Reports = array('Inactivo', 'Activo','');

if (isset($_POST['amllChannel']) && $_POST['amllChannel'] > 0) {
    $Channel = ' AND amll_Channel = ' . $_POST['amllChannel'];
}
if (isset($_POST['amllCountry']) && $_POST['amllCountry'] != '') {
    $Country = ' AND Country_ID = ' . $_POST['amllCountry'];
}
if (isset($_POST['amllChannel']) && $_POST['amllFlag'] != '') {
    $Flag = ' AND REPORT = ' . $_POST['amllFlag'];
}
?>
<table width="100%"  border="0" cellspacing="1" cellpadding="1">
    <tr bgcolor="#D9DEAB" style="text-align:center;height:22px">
        <td>ID</td>
        <td>Nivel</td>
        <td>Canais</td>
        <td>Pais</td>
        <td>Periodo</td>
        <td>Value</td>
        <td>Moeda</td>
        <td>Envios</td>
        <td width="60%">Documentos</td>
        <td>Reportar</td>
    </tr>
    <?php
    $GET = $GLOBALS['MYT']->db_array("SELECT REF, LEVEL, INTERV, AMOUNT, QUANT, DOCS, REPORT, pai_Sufijo AS Country_ID, amll_Channel, amll_Currency
								  FROM hd_amllocks
								  	INNER JOIN hd_paises ON pai_CodElite = Country_ID
									WHERE REF > 0 $Flag $Channel $Country
								ORDER BY Country_ID,LEVEL");
    for ($r = 1; $r <= $GET[0]; $r++) {
        $GETDocs = $GLOBALS['MYT']->db_array("SELECT tdc_Tipo FROM hd_documentostipos WHERE tdc_Id IN ('{$GET[$r]['DOCS']}')"); ?>
        <tr bgcolor="<?php echo gridlines($r); ?>">
            <td NOWRAP><?php echo mn_field('button', 'ED', 'amll_New', $GET[$r]['REF'], '', '', '', '" style="width:40px" onclick="
				 idwindow(\'Propriedades do Limite AML\',\'amllwin\',\'amllwin\',\'_response/call.php?get=Compliance/a02_frmAMLevel&aml_ID=' . $GET[$r]['REF'] . '\',500,400);'); ?></td>
        <td NOWRAP style="text-align:right"><?php echo $GET[$r]['LEVEL']; ?></td>
        <td NOWRAP style="text-align:right"><?php echo $__sysChannels[$GET[$r]['amll_Channel']]; ?></td>
        <td NOWRAP style="text-align:center"><?php echo $GET[$r]['Country_ID']; ?></td>
        <td NOWRAP style="text-align:center"><?php echo $GET[$r]['INTERV']; ?></td>
        <td NOWRAP style="text-align:right"><?php echo $GET[$r]['AMOUNT']; ?></td>
        <td NOWRAP style="text-align:right"><?php echo $GET[$r]['amll_Currency']; ?></td>
        <td NOWRAP style="text-align:right"><?php echo $GET[$r]['QUANT']; ?></td>
        <td NOWRAP><?php for ($dr = 1; $dr <= $GETDocs[0]; $dr++) {echo $GETDocs[$dr]['tdc_Tipo'] . ',';} ?></td>
        <td NOWRAP><?php echo $aml_Reports[$GET[$r]['REPORT']]; ?></td>
    </tr>
    <?php } ?>
</table>
